/*
============================================================================
 Name        : Ticker.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CTicker declaration
============================================================================
*/

#ifndef __TICKER_H__
#define __TICKER_H__

// INCLUDES
#include <e32std.h>
#include <e32base.h>

#include "MPluginContainer.h"

class CTicker : public CBase
{
public: // Constructors and destructor
	IMPORT_C ~CTicker();
	IMPORT_C static CTicker* NewL(MPluginContainer* aContainer);
	IMPORT_C static CTicker* NewLC(MPluginContainer* aContainer);


private:
	CTicker(MPluginContainer* aContainer);
	void ConstructL();


public:
	IMPORT_C void SetText(const TDesC& aText, TInt aWidth);
	IMPORT_C void SetTextFormat(TRefByValue<const TDesC16> aFmt, TInt aWidth, ...);

	IMPORT_C const TDesC& GetText();
	IMPORT_C TInt Length();

	IMPORT_C void Activate();
	IMPORT_C void Deactivate();


private: //static functions
	static TInt TimerTick(TAny *obj);


private: //new functions
	void PreSetText(TInt aWidth);
	void PostSetText();


private: //instance data
	MPluginContainer* iContainer;

	CPeriodic *iTimer;
	TCallBack iTimerTick;	
	
	TBuf<500> iTickerText;
	TBuf<500> iMovingText;
	
	TInt iPos;
	TInt iWidth;
};

#endif // __TICKER_H__
